﻿<!DOCTYPE html>
<html>
 <head> 
  <meta charset="UTF-8" /> 
  <title>编辑公众号</title> 
  <link rel="stylesheet" href="../../assets/js/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="../../assets/css/global.css" media="all">
  <link rel="stylesheet" href="../../assets/js/font-awesome/css/font-awesome.min.css">
 </head> 
 <body> 
     <div class="admin-main">
         <form class="layui-form" action="/api/wechat/sbpromote/save">
 
             <div class="layui-form-item">
                 <label class="layui-form-label">活动名称</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input" bindattr="prmname" name="prmname" lay-verify="required" placeholder="请输入活动名称" />
                 </div>
             </div>

             <div class="layui-form-item">
                 <label class="layui-form-label">备注</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input" bindattr="remark" name="remark"   placeholder="请输入活动备注" />
                 </div>
             </div>

             <div class="layui-form-item">
                 <label class="layui-form-label">公众号名称id</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input"   bindattr="wid" name="wid" lay-verify="required" placeholder="" />
                 </div>
             </div>
             <div class="layui-form-item">
                 <label class="layui-form-label">赠送总数量</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input" bindattr="limitcount" name="limitcount" lay-verify="required" placeholder="赠送总数量" />
                 </div>
             </div>


             <div class="layui-form-item">
                 <label class="layui-form-label">任务数</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input" bindattr="targetcount" name="targetcount" lay-verify="required" placeholder="任务数" />
                 </div>
             </div>

             <div class="layui-form-item">
                 <label class="layui-form-label">基础数量（假送）</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input" bindattr="basealreadycount" name="basealreadycount" lay-verify="required" placeholder="基础数量（假送）" />
                 </div>
             </div>

             <div class="layui-form-item">
                 <label class="layui-form-label">产品图封面地址url</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input" bindattr="productimageurl" name="productimageurl" lay-verify="required" placeholder="产品图封面地址url" />
                 </div>
             </div>

             <div class="layui-form-item">
                 <label class="layui-form-label">活动开始时间</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input" id="starttime" bindattr="starttime" name="starttime" lay-verify="required" placeholder="活动开始时间" />
                 </div>
             </div>


             <div class="layui-form-item">
                 <label class="layui-form-label">活动结束时间</label>
                 <div class="layui-input-block">
                     <input type="text" class="layui-input" id="endtime" bindattr="endtime" name="endtime" lay-verify="required" placeholder="活动结束时间" />
                 </div>
             </div>




             <div class="layui-form-item">
                 <label class="layui-form-label">赠送礼品列表（换行区分不同礼品）</label>

                 <div class="layui-input-block">
                     <textarea class="layui-textarea" bindattr="prmdesc" id="prmdesc" name="accountcontent"></textarea>

                 </div>
             </div>


             <div class="layui-form-item">
                 <div class="layui-input-block">
                     <input type="button" lay-submit="" lay-filter="save" class="layui-btn J_ajaxSubmit" value="保存" />
                     <input type="reset" class="layui-btn layui-btn-primary" value="重置" />
                 </div>
             </div>
         </form>
     </div>  
 </body>
 
<script type="text/javascript" src="../../assets/js/layui/layui.js"></script>
<script type="text/javascript">
    layui.cache.page = 'promote';
	layui.config({
		version : "1.0.1",
		base : 'js/'
    }).use('promote');

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#starttime', //指定元素
            type: "datetime"
        });
        laydate.render({
            elem: '#endtime', //指定元素
            type: "datetime"
        });
    });

    function onDataLoadedCallback(data) {

       
         
    }

    //赠送礼品数据
    function onBeforeSubmmit(data) {
        var $ = layui.jquery;
        var txtBooks = $("#prmdesc").val();
        if (txtBooks == "")
            return data;

        data.prmdescModel = new Object();
        data.prmdescModel.BookNames  = txtBooks.split("\n");

        return data;

    }
 

  
</script>
</html>